﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
	String basePath = "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="/">
    <link href="plugins/kindeditor/themes/simple/simple.css" type="text/css" rel="stylesheet">
    <link href="plugins/kindeditor/themes/default/default.css" rel="stylesheet">
    <!-- jsp文件头和头部 -->
    <%@ include file="../index/top.jsp" %>

</head>
<body class="no-skin">

<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">

                <div class="page-header">
                    <h1>
                        <small>
                            <i class="ace-icon fa fa-angle-double-right"></i>
                            编辑问题
                        </small>
                    </h1>
                </div><!-- /.page-header -->

                <div class="row">
                    <div class="col-xs-12">

                        <form action="problem/${MSG }.do" name="classifyForm" id="classifyForm" method="post"
                              class="form-horizontal">
                              	<input type="hidden" name="id" id="id" value="${problem.id}"/>
                            	 <input type="hidden" name="parent_id" id="parent_id"
                                   value="${pd.parent_id}"/> 
                             <input type="hidden" id="pn" value="${problem.problemName}"/>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 上级 :</label>
                                <div class="col-sm-9">
                                    <div style="padding-top:5px;">
                                        <div class="col-xs-4 label label-lg label-light arrowed-in arrowed-right">
                                            <b>${null == problem.problemName ?'(无) 此项为顶级菜单':problem.problemName}</b>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 序号 :</label>
                                <div class="col-sm-9">
                                    <input type="number" name="seat" id="seat" value="${problem.seat }" placeholder="这里输入问题序号"
                                          min="1" class="col-xs-10 col-sm-5"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 问题 :</label>
                                <div class="col-sm-9">
                                    <input type="text" name="problem_name" id="problem_name" value="${problem.problem_name }" placeholder="这里输入问题"
                                           class="col-xs-10 col-sm-5"/>
                                </div>
                            </div>
                             <c:if test="${pd.id != null && pd.id !=0}">
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 问题详情 :</label>
                                <div class="col-sm-9" style="margin-top:10px;">
                                 <textarea class="content" style="width: 1000px; height: 400px;"
                                    name="image_text" id="image_text">${problem.image_text}</textarea>
                                </div>
                            </div>
                            </c:if>
                            <div class="clearfix form-actions">
                                <div class="col-md-offset-3 col-md-9">
                                    <a class="btn btn-mini btn-primary" onclick="save();">保存</a>
                                    <a class="btn btn-mini btn-danger" onclick="goback('${pd.id}');">取消</a>
                                </div>
                            </div>
                            <div class="hr hr-18 dotted hr-double"></div>
                        </form>

                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.page-content -->
        </div>
    </div>
    <!-- /.main-content -->


    <!-- 返回顶部 -->
    <a href="#" id="btn-scroll-up"
       class="btn-scroll-up btn btn-sm btn-inverse"> <i
            class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>

</div>
<!-- /.main-container -->

<!-- basic scripts -->
<!-- 页面底部js¨ -->
<%@ include file="../index/foot.jsp" %>
<!--提示框-->
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
<script type="text/javascript" src="static/js/common/file_upload.js"></script>
<script type="text/javascript" src="plugins/kindeditor/kindeditor-all.js"></script>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(top.hangge());

    $(function () {
        //创建富文本编辑器
        TAOTAO.kingEditorParams = {
            //指定上传文件参数名称
            filePostName: "uploadFile",
            //指定上传文件请求的url。
            uploadJson: '<%=basePath%>pic/upload',
            //上传类型，分别为image、flash、media、file
            dir: "image",
            extraFileUploadParams: {isCom: "01", width: 800, height: 800, quality: 0.8, end: "view"}
        }

        TAOTAO.kingEditorAutoParams = {
            //指定上传文件参数名称
            filePostName: "uploadFile",
            //指定上传文件请求的url。
            uploadJson: '<%=basePath%>pic/upload',
            //上传类型，分别为image、flash、media、file
            dir: "image",
            extraFileUploadParams: {isCom: "00"}
        }
        goodsAddEditor = TAOTAO.createEditor("#classifyForm [name=image_text]");
        //初始化类目选择和图片上传器
        TAOTAO.initOnePicUpload($("input[name=icoImg]").val());

    });

    //返回
    function goback(id) {
        top.jzts();
        window.location.href = "<%=basePath%>problem/getProblemList.do?id=" + id;
    }

    //保存
    function save() {
        if ($("#problem_name").val() == "") {
            $("#problem_name").tips({
                side: 3,
                msg: '请输入问题',
                bg: '#AE81FF',
                time: 2
            });
            $("#problem_name").focus();
            return false;
        }
        var pn=$("#pn").val();
        if(pn != null && pn !=''){
        	goodsAddEditor.sync();
        }
        $("#classifyForm").submit();
    }

</script>
</body>
</html>